#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int outPrime ( int argc, char const *argv[] ) {
    int num = 5;
    int i = 2;
    int isPrime = 1;
    int cnt = 0;
    // printf("2\t3\t");
    for ( num = 2; num < 101; num++ ) {
        // use max to avoid every for loop calculation
        int max = sqrt(num);
        for ( i = 2; i <= max; i++ ) {
            if ( num % i == 0 ) {
                isPrime = 0;
                break;
            }
        }
        if ( isPrime == 0 ) {
            isPrime = 1;
        } else {
            printf("%d\t",num);
            cnt++;
            if ( cnt == 6 ) {
                printf("\n");
                cnt = 0;
            }
        }
    }
    return EXIT_SUCCESS;
}
